package eteam.aps.systemservice.dal;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import eteam.aps.systeminterface.model.entity.LogEntity;
import eteam.aps.systemservice.dal.mapper.ILogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 日志数据操作类
 */
@Service
public class LogDal {
    @Autowired
    private ILogMapper logMapper;

    /**
     * 分页查询数据
     *
     * @param page:    分页参数
     * @param wrapper: 检索参数
     * @return: 分页数据
     */
    public IPage<LogEntity> selectPageList(IPage<LogEntity> page, Wrapper<LogEntity> wrapper) {
        return logMapper.selectPage(page, wrapper);
    }

    /**
     * 新增日志数据
     *
     * @return: 受影响行数
     */
    public int insertLog(LogEntity entity) {
        return logMapper.insert(entity);
    }

    /**
     * 根据ID删除
     *
     * @param id: ID
     */
    public Integer deleteById(String id) {
        return logMapper.deleteById(id);
    }

    /**
     * 根据ID批量删除
     *
     * @param ids: ID集合
     */
    public Integer deleteByIds(List<String> ids) {
        return logMapper.deleteBatchIds(ids);
    }
}
